package com.lagou.client;

import com.lagou.pojo.RpcRequest;
import com.lagou.service.UserService;

import java.util.UUID;

public class ClientBootStrap {

    public static  final String providerName="UserService#sayHello#";

    public static void main(String[] args) throws InterruptedException {

        String word = "are you ok?";

        RpcRequest rpcRequest = new RpcRequest();
        rpcRequest.setRequestId(UUID.randomUUID().toString().replaceAll("-",""));
        rpcRequest.setClassName(UserService.class.getSimpleName());
        rpcRequest.setMethodName("sayHello");
        rpcRequest.setParameters(new Object[]{word});
        rpcRequest.setParameterTypes(new Class<?>[]{word.getClass()});

        RpcConsumer rpcConsumer = new RpcConsumer();
        UserService proxy = (UserService) rpcConsumer.createProxy(UserService.class, rpcRequest);

        while (true){
            Thread.sleep(2000);
            System.out.println(proxy.sayHello(word));
        }


    }




}
